home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.3
/
Video Toaster v4.3.iso
/
3.1
/
toasterall
/
arexx_examples
/
lwm
/
lightswarm.lwm
< prev
next >
Wrap
Text File
|
1993-10-01
|
7KB
|
209 lines
/* CMD: LightSwarm
* Make cloud of lights from selected points on an object, save scene file.
* Load null object parent and all lights with LW 'LoadFromScene' option.
* By Arnie Cachelin © 1993 NewTek Inc.
* $VER: Fri Oct 1 12:58:17 1993
*/
mxx="LWModelerARexx.port"
signal on error
signal on syntax
mxx_add = addlib(mxx,0)
call main
if (mxx_add) then call remlib(mxx)
exit
syntax:
error:
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
if (mxx_add) then call remlib(mxx)
exit
main:
call sel_mode(USER)
num=xfrm_begin()
if num>399 then num=399 /* No more than 400 lights in a scene */
if num=0 then do
call notify(1,"No Points Selected!")
exit
end
MFile=getfilename("-- Save Scene --","RAM:")
if MFile ~="(none)" then filename=MFile
else exit
sysnam = 'LightSwarm Scene: 'MFile
call req_begin sysnam
nam=req_addcontrol("Light Name",'s',20)
typ=req_addcontrol("Light Type ","CH","Distant Point Spot")
intn=req_addcontrol("Intensity (%)","N")
fal=req_addcontrol("Falloff (%)","N")
rgb=req_addcontrol("Color",'V')
flar=req_addcontrol("Lens Flare",'B')
fint=req_addcontrol("Flare Intensity (%)","N")
fdis=req_addcontrol("Flare Dissolve (%)","N")
shad=req_addcontrol("Shadow Casting",'B')
og=req_addcontrol("Outer Glow Light",'B')
call req_setval nam, "LightSwarm"
call req_setval typ, 2
call req_setval intn, 100.0000
call req_setval fal, 0.0000
call req_setval shad, 0
call req_setval flar, 1
call req_setval og, 1
call req_setval fint, 50.000
call req_setval fdis, 0.0000
call req_setval rgb, '255 255 255'
if (~req_post()) then do
call req_end
return
end
type.1=req_getval(typ)-1
name.1=req_getval(name)
int.1=req_getval(intn)/100
Fall.1=req_getval(fal)/100
FlInt.1=req_getval(fint)/100
FlDis.1=req_getval(fdis)/100
color.1=req_getval(rgb)
parse var color.1 r g b
color.1= r%1 g%1 b%1
shadow.1=req_getval(shad)
flare.1=req_getval(flar)
glow=req_getval(og)
if glow then do
call req_setval nam, name.1'_OG'
if (~req_post()) then glow=0
end
if glow then do
type.2=req_getval(typ)-1
name.2=req_getval(name)
int.2=req_getval(intn)/100
Fall.2=req_getval(fal)/100
FlInt.2=req_getval(fint)/100
FlDis.2=req_getval(fdis)/100
color.2=req_getval(rgb)
parse var color.2 r g b
color.2= r%1 g%1 b%1
shadow.2=req_getval(shad)
flare.2=req_getval(flar)
end
call req_end
say filename
if ~open(MotFile,filename,'W') then call Bummer("Can't open file "filename)
Call WriteStart()
do i=1 to num
parse value xfrm_getpos(i) with x y z .
Call WriteLight(i,1)
if glow then Call WriteLight(i,2)
end
Call WriteEnd()
call Close(MotFile)
return
WriteStart: PROCEDURE EXPOSE MotFile
call writeln(MotFile,"LWSC")
call writeln(MotFile,"1")
call writeln(MotFile,"")
call writeln(MotFile,"FirstFrame 1")
call writeln(MotFile,"LastFrame 1")
call writeln(MotFile,"FrameStep 1")
call writeln(MotFile,"")
call writeln(MotFile,"LoadObject NullObject")
call writeln(MotFile,"ObjectMotion (unnamed)")
call writeln(MotFile," 9")
call writeln(MotFile," 1")
call writeln(MotFile," 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0")
call writeln(MotFile," 0 0 0.0 0.0 0.0")
call writeln(MotFile,"EndBehavior 1")
call writeln(MotFile,"ShadowOptions 7")
call writeln(MotFile,"")
return
WriteEnd: PROCEDURE EXPOSE MotFile
call writeln(MotFile,"CameraMotion (unnamed)")
call writeln(MotFile," 9")
call writeln(MotFile," 1")
call writeln(MotFile," 0.002420 24.997030 -144.084366 0.0 0.0 0.0 1.0 1.0 1.0")
call writeln(MotFile," 0 0 0.0 0.0 0.0")
call writeln(MotFile,"EndBehavior 1")
call writeln(MotFile,"ZoomFactor 3.200000")
call writeln(MotFile,"RenderMode 2")
call writeln(MotFile,"RayTraceEffects 0")
call writeln(MotFile,"Resolution 1")
call writeln(MotFile,"Overscan 1")
call writeln(MotFile,"Antialiasing 0")
call writeln(MotFile,"AdaptiveSampling 1")
call writeln(MotFile,"AdaptiveThreshold 8")
call writeln(MotFile,"FilmSize 2")
call writeln(MotFile,"FieldRendering 0")
call writeln(MotFile,"MotionBlur 0")
call writeln(MotFile,"DepthOfField 0")
call writeln(MotFile,"")
call writeln(MotFile,"SolidBackdrop 1")
call writeln(MotFile,"BackdropColor 0 0 0")
call writeln(MotFile,"ZenithColor 0 40 80")
call writeln(MotFile,"SkyColor 120 180 240")
call writeln(MotFile,"GroundColor 50 40 30")
call writeln(MotFile,"NadirColor 100 80 60")
call writeln(MotFile,"FogType 0")
call writeln(MotFile,"DitherIntensity 1")
call writeln(MotFile,"AnimatedDither 0")
call writeln(MotFile,"")
call writeln(MotFile,"DataOverlayLabel ")
call writeln(MotFile,"")
call writeln(MotFile,"ViewMode 5")
call writeln(MotFile,"ViewAimpoint 0.000000 0.000000 0.000000")
call writeln(MotFile,"ViewDirection 0.000000 -0.174533 0.000000")
call writeln(MotFile,"ViewZoomFactor 3.200000")
call writeln(MotFile,"LayoutGrid 3")
call writeln(MotFile,"GridSize 50.000000")
call writeln(MotFile,"ShowObjects 1")
call writeln(MotFile,"ShowBones 0")
call writeln(MotFile,"ShowLights 1")
call writeln(MotFile,"ShowCamera 1")
call writeln(MotFile,"ShowMotionPath 1")
call writeln(MotFile,"ShowSafeAreas 0")
call writeln(MotFile,"ShowBGImage 0")
call writeln(MotFile,"ShowFogRadius 0")
call writeln(MotFile,"ShowRedraw 0")
return
/* Change the text in this routine to change lights produced */
WriteLight: PROCEDURE EXPOSE MotFile x y z color. int. type. shadow. flare. name. Fall. FlInt. FlDis.
arg n, f
channels=" "||x y z||" 0.0 0.0 0.0 1.0 1.0 1.0"
spline=" 0 0 0.0 0.0 0.0"
say channels spline
call writeln(MotFile,"AddLight")
call writeln(MotFile,"LightName "name.f||"."||n)
call writeln(MotFile,"LightMotion (unnamed)")
call writeln(MotFile," 9") /* Channels */
call writeln(MotFile," 1")
call writeln(MotFile,channels)
call writeln(MotFile,spline)
call writeln(MotFile,"EndBehavior 1")
call writeln(MotFile,"ParentObject 1") /* Our NULL Object */
call writeln(MotFile,"LightColor "color.f)
call writeln(MotFile,"LgtIntensity "int.f)
call writeln(MotFile,"LightType "type.f)
call writeln(MotFile,"Falloff "Fall.f)
if flare~=0 then do
call writeln(MotFile,"LensFlare 1")
call writeln(MotFile,"FlareIntensity "FlInt.f)
call writeln(MotFile,"FlareDissolve "FlDis.f)
call writeln(MotFile,"LensFlareFade 4") /* You'll have to play around */
call writeln(MotFile,"LensFlareOptions 33") /* figure these two out... */
end
else call writeln(MotFile,"LensFlare 0")
if shadow.f~=0 then call writeln(MotFile,"ShadowCasting 1")
else call writeln(MotFile,"ShadowCasting 0")
call writeln(MotFile,"")
return
Bummer:
ARG etxt
t=Notify(1,'!Rexx Script Error','@'ETxt)
exit